<floatFuncs>

	<definitionOfFloatFunc>
		Functions for transforming audio and for modifying floating points in nodes
		are the same type of function.
		They operate on the same quantity of input and output floating points, in the same array.
	</definitionOfFloatFunc>
	
	The syntax I define here does not have to be permanent. I just need a simple syntax
	to get things started, and it can EASILY be changed later, or use multiple syntaxs.
	
	There are at least 3 syntaxs:
		netDefineSyntax,
		funcParamFinderSyntax,
		floatingPointArrayFuncSyntax.
		
	
	//Purpose of netDefineSyntax is define the standards of which arrays
	//go in a network and which in a node, their sizes and size constraint relationships,\
	//and which are Object arrays and which are double arrays.
	[netDefineSyntax]
		Type: double array, Object array.
		ArraySize: literal, equal, multiply*, power^.
		Location:
			??? index m in network,
			??? index i in node,
			??? array b in child list x, array y in child list g, etc,
			??? how to handle multiple nodes from a power^ array?

	//Purpose of funcParamFinderSyntax is, in the same way for each iteration over the things in a node,
	//to choose floating point(s) from some of the floating point arrays and concat them into
	//a floating point array of the right size, run a function on that array, and copy the resulting
	//floating points (written in the same array at same indexs)
	//individually back to their original locations.
	[funcParamFinderSyntax]
		Concat subsets of many locations, which must all be double arrays (no Object arrays):
			?get what from? network,
			?get what from? node,
			?get what from? array b in child list x,
			?get what from? array y in child list g,
			?get what from? etc,
			?get what from? how to handle multiple nodes from a power^ array?
			
	//Purpose of floatingPointArrayFuncSyntax is to statelessly
	//change the floating points in a small array.
	[floatingPointArrayFuncSyntax]
		May be similar to codesimian syntax, but not as complex as codesimian objects.
		The simplest thing would be to use a temporary floating point array
		and view the concat of it and the parameter array.
		Probably loops should not be allowed,
		because they make network cycles too hard to predict the duration of.
		This is a possible syntax, where multiple lines are used, and a-z are array indexs 0-25.
		+ a a b //a += b
		square f a //f = a*a

	
	Operators written in floatingPointArrayFuncSyntax...
	Most can exceed floating point range. Some have other dangers like divide by 0...
	Operators have at least 1 parameter (a, b, c...).
	They output 1 parameter, which is not written here,
	and that can equal one of the existing parameters or not, like a = a + b, or a = b + c.
	Operators include:
		Continuous math operators:
			+ a b
				Java translation: "+ a b c" --> "a=b+c;"
			- a b
			* a b
			/ a b
			% a b
			power a b
			log a b
			powere a
			loge a
			powertwo a
			logtwo a
			square a
			sqrt a
			sine a
			arcsine a
				Java translation: "arcsine a b" --> "a=Math.asin(b);"
			cosine a
			arccosine a
			tangent a
			arctangent a
			absval a
		Logic and discrete operators:
			min a b
			max a b
			floor a
			ceil a
			round a
			= a
			== a b
			< a b //returns 1 if a<b, else returns 0
			<= a b
			and a b //returns 1 if a and b are positive, else returns 0
			or a b
			xor a b
			not a
			+one a
			-one a
			=zero

	Need control-flow operators and a tree or network shape of code for good evolution.
	Maybe a "floatingPointArrayFuncSyntax" function
	should be able to call other floatingPointArrayFuncSyntax functions.
	
	<question>
		Should a function be a network or node?
		<sideEffect>
			That would give it recursion ability,
			and it would be easier to interface it to networks and nodes (but I dont know if I need that).
		</sideEffect>
		<similar>
			I do need some type of function that merges 2 nodes in a network,
			but that maybe should be a different type of thing.
		</similar>
	</question>
	
	Codesimian code may be close to what I need.
	
	<question>
		Should all stateless functions be in the same array which is shared by the whole program,
		and convert the functions to text
		only when save the code that points into that array (with an int index)?
		<question>Should it be a Map of String to function instead?</question>
	</question>

	The array/map of stateless functions includes evolved functions.
	
	Without allowing recursion, what are the attributes of a function?:
		Floating point array that is simultaneously input and output, but it should be copied, not used.
		Temporary floating point array that can be used for saving extra numbers during calculations.
		Array of functions (and ints for their parameters) to call in sequence,
	
	Example of a hard-coded function, whose name is "+", and adds 2 numbers and returns 1 number:
		[ [0, 0, 0], [], [] ]
		//since its in the set of hard-coded functions, special processing is done
		//instead of using its second array which is a sequence.
		
	Example of an evolved function, "x+y*z", which uses 3 numbers and returns 1 number:
		[
			[0, 0, 0, 0],
			[], //temporary array not needed in this simple function
			[
				multiplyFunc, //from indexs 2 and 3 to 2
				plusFunc //from indexs 1 and 2 to 0
			]
		]
	This does not solve the problem of specifying which indexs to use for each child function.
	Because the child funcs have their own float arrays, temporary float arrays are not needed.
	
	<globalArrayOfFuncs>
		If every func has an int index in a global array, then small int arrays can be code.
		globalArray[501] "+" has 2 inputs and 1 output
		globalArray[502] "*" has 2 inputs and 1 output
		globalArray[503] "sine" has 1 inputs and 1 output
		globalArray[504] "x+y*z" has 3 inputs and 1 output
		
		<stack>
			Example of an evolved function "x+y*z" called on indexs 37-40.
			pushFromIndex 38
			pushFromIndex 39
			exec 501 //globalArray[501] "+" has 2 inputs and 1 output
			pushFromIndex 40
			exec 502 //globalArray[502] "*" has 2 inputs and 1 output
			popToIndex 37
		</stack>
		
		How to do control-flow?
		<stack>
			Example of an evolved function "x+y*z" called on indexs 37-40.
			pushFromIndex 38
			pushFromIndex 39
			exec 501 //globalArray[501] "+" has 2 inputs and 1 output
			pushFromIndex 40
			exec 502 //globalArray[502] "*" has 2 inputs and 1 output
			popToIndex 37
			//How to do control-flow?
		</stack>
		
	</globalArrayOfFuncs>
	
	
	
	Should functions be allowed to have different size input and output array-ranges?
		If practical, that should be avoided.
		
	Should none, some, or all functions be networks?

	Lets try this again... Without allowing recursion, what are the attributes of a function?:
		int size (or array that size?),
	
	------------------------------
		
	An efficient representation of a function could be an int array, byte array,
	or String where groups of 4 chars are used each iteration.
	Either way, each 32 bits are an operator, a target location, and 2 parameter locations.
	Example: the pseudocode "a=a+b*c" would be literal code "*bbc+aab".
	It would be more flexible to store them as 4 ints each.
	
	That same code as int array: { '*', 1, 1, 2, '+', 0, 0, 1 }.
	If it uses only java operators (including + and *), it can be completely optimized as a java func.
	But how to call that func if it takes more than 2 parameters or returns more than 1?
	
	3/4 of the ints in the array are indexs in a double array.
	
	If the size of that array is defined the same way as arrays in nodes,
	the size is arraySize4*someOtherArray.
	
	Could each 4 indexs (or other size?) be represented as a node in a network for evolving,
	and as an int array when more speed is needed?
	For example, a + node would have 2 childs in its input child list and 1 child in its output child list.
	But how would a node, when executing, know which input to write to in one of its output childs?
	Maybe there should be 1 node for each index in the double array instead of each function,
	and its childs could be the nodes representing the doubles that can be written after using this double.
	
	{ '*', 1, 1, 2, '+', 0, 0, 1, '+', 1, 0, 2 }.
	node2 -> node1
	node1 -> node1 and node0
	node0 -> node1 and node0
	I dont see how this makes evolving easier, or even how it would execute. What does the first + do?

	At least for node functions, stateless is not needed, because it can be used many times while
	the network executes in the same thread.
	
	<subsetsOfIndexsOfArray>
		Another possible representation of evolved code:
		
		Definition of THEFUNC:
		double array A.
		Sequence of subsets of A's indexs, allowing duplicates (or multiple references to the same subset?).
		Subsets can have different sizes, allow duplicates, and enforce no order of indexs.
		For each subset, there is a function which takes the same number of input/output floats.
		This does not support control-flow actions, like IF, but lets think about that later...
		Do the sequence of subsets/functions 1 time, and some subset of A is the output of THEFUNC.
		
		That is easier to evolve (but still does not support complex enough evolution)
		because the funcs which pair with subsets can be replaced with those of the same size,
		and whole sequences of subsets can be evolved independently of the funcs paired with subsets.
		
		For example, [0,1,2,3,4] may evolve this sequence of subsets: [[2,3,4], [1,2,3], [0,1,2], [0,1]].
		It may also evolve this sequence: [[1,0], [2,0], [3,0], [4,0]]
		because its good for summing or multiplying 4 things.
		
		Maybe [[1,0], [2,0], [3,0], [4,0]] should be viewed as an array size 4
		and have sequences of subsets applied to it the same way as for [0,1,2,3,4].
		When [2,0] and [4,0] are in a subset together, what does that mean?
		If [2,0] was paired with +=, and [4,0] was paired with *=,
		then the subset that points at [2,0], [4,0], and [1,0]
		may be an IF that takes its condition from the return of [2,0] and runs += or *= but not both.
		That is the best way to do control-flow in this file so far.
		It does not allow loops, but it does allow exponentially large repeating of the same code,
		like if you do +(b b), and b is +(c c), and c is +(d d)...
		Maybe it does allow loops, if d contained b or c, but would it be an infinite loop?
		It is looking more like CodeSimian now.
		
		There should be a global (or many local?) array with hard-coded functions
		at low index and evolved functions at higher index, and just give an int to execute
		a func on an array.
		<exampleFunc>
			+ has 3 parameters.
			<question>Should I specify that 2 are input and 1 output?</question>
			<hardCoding>
				+ can be hard-coded into the Audivolv interpreter, and sine could be too,
				but not all evolved functions will be.
			</hardCoding>
		</exampleFunc>
		<exampleFunc>
			sine has 2 parameters.
			It could be defined this way:
			public class Sine implements VectorTransform{
				public int size(){ return 2; }
				public void run(double d[]){ d[0] = Math.sin(d[1]); }
			}
			<question>
				How can Sine be efficiently used with sets of indexs if it uses a literal array?
				Maybe this way?:
				public class Sine implements VectorTransform{
					public int size(){ return 2; }
					public void run(double d[], int i[]){
						d[i[0]] = Math.sin(d[i[1]]);
					}
				}
				That does not look efficient, but it may be enough.
				But it gets more complex when you have sets pointing at sets recursively...
			</question>
		</exampleFunc>
		
		<question>
			Should I specify the possible double ranges, like if 3<x<4 and 5<y<10 then 8<return<14.
		</question>
		
		How to specify the sizes of these funcs?
		
		<efficiency>
			That is a good logic to do, but how can it be efficient for memory and cpu?
			
			Each func should be transformable to a String of Java code, with standard names for vars.
			Example var names:
				d0, d1, d2, d3...
			Example Java code:
				d1 = d2 * d3;
				d0 = d1 + d2;
				if(0 < d0){
					d2 = d1 * d2;
				}else{
					d2 = d0;
				}
		</efficiency>
		
		
		
		<exampleOperators>
			if1then5else3(indexSetSize1 indexSetSize5 indexSetSize3)
			<isThisOperatorTooComplex>
				if(anySetOfAtLeast1Index anySetOfAtLeast1Index anySetOfAtLeast1Index)
				When would the set sizes be allowed to change?
				The if(...) executes its first set then reads the first double from it,
				so the only constraint should be the first set is at least size 1.
				<question>Should it execute the first set or just use its first double?</question>
			</isThisOperatorTooComplex>
			<question>
				if1then5else3(...) operates on 3 sets of indexs.
				What operator can take if1then5else3 as a parameter?
				???
			</question>			
		</exampleOperators>
		
		
		
	</subsetsOfIndexsOfArray>

</floatFuncs>